package com.neusoft.edu.smartschool.app.parttern.other;

/**
 * @author: yeruyi
 * @date: 2018/5/29
 * @email: yeruyi_roy@outlook.com
 * @modify: 2018/5/29 创建文件
 */
public class ThreadPoolProxyFactory {

    static ThreadPoolProxy mNormalThreadPoolProxy;
    static ThreadPoolProxy mSaveThreadPoolProxy;

    /**
     * 得到普通线程池代理对象mNormalThreadPoolProxy
     */
    public static ThreadPoolProxy getNormalThreadPoolProxy() {
        if (mNormalThreadPoolProxy == null) {
            synchronized (ThreadPoolProxyFactory.class) {
                if (mNormalThreadPoolProxy == null) {
                    mNormalThreadPoolProxy = new ThreadPoolProxy(5, 5);
                }
            }
        }
        return mNormalThreadPoolProxy;
    }

    /**
     * 得到储存线程池代理对象mDownLoadThreadPoolProxy
     */
    public static ThreadPoolProxy getSaveThreadPoolProxy() {
        if (mSaveThreadPoolProxy == null) {
            synchronized (ThreadPoolProxyFactory.class) {
                if (mSaveThreadPoolProxy == null) {
                    mSaveThreadPoolProxy = new ThreadPoolProxy(3, 3);
                }
            }
        }
        return mSaveThreadPoolProxy;
    }
}